//
//  ccHomeSubViewController1.m
//  CloudCat
//
//  Created by Xiaomin Cai on 4/21/12.
//  Copyright (c) 2012 Taobao. All rights reserved.
//

#import "ccHomeSubViewController1.h"

@interface ccHomeSubViewController1 ()

@end

@implementation ccHomeSubViewController1
@synthesize page = _page;
@synthesize twitterVC = _twitterVC;

- (id)init {
    if (self = [super init]) {
        _page = TabPageHome1;
        bInited = NO;
        _twitterVC = nil;
    }
    return self;
}

- (id)initWithPage:(TabPageHomePage)aPage {
    if (self = [super init]) {
        self.page = aPage;
        bInited = NO;
        _twitterVC=nil;
    }
    return self;
}
-(void)dealloc
{
    [super dealloc];
    if(_twitterVC)
    {
        [_twitterVC release];
    }
}

- (void)setPage:(TabPageHomePage)aPage {
    _page = aPage;
    titleLabel.text = [NSString stringWithFormat:@"第%d页",_page];
    if(_page==TabPageHome1)
    {
        self.twitterVC.view.hidden = NO;
    }
    else {
        self.twitterVC.view.hidden = YES;
    }
}

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    titleLabel.text = [NSString stringWithFormat:@"第%d页",_page];
    if(bInited==NO)
    {
        bInited = YES;
        RKTwitterViewController* viewController = [[[RKTwitterViewController alloc] initWithNibName:nil bundle:nil] autorelease];
        self.twitterVC = viewController;
        [self.view addSubview:viewController.view];
    }
    NSLog(@"hello");
}

- (void)viewDidUnload
{
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}

@end
